//===================================================================================
// $$
//
// Coder: Code Milker v1.0
// 0 - upper
// 1 - lower
//===================================================================================


namespace App.Domain.Handlers {
    using System;
    using App.Data;
    using App.Domain.Contracts;

    public class DeleteWork {
        private readonly IWorkRepository _WorkRepository;

        public DeleteWork(IWorkRepository WorkRepository) {
            _WorkRepository = WorkRepository;
        }

        public virtual void Execute(Guid workId) {
            var WorkToDelete = _WorkRepository.GetWork(workId);

            if (WorkToDelete != null) {
                _WorkRepository.Delete(workId);
            }
            else {
                throw new BusinessServicesException("UnableToDeleteVehicleExceptionMessage");
            }
        }
    }
}
